import { Module } from '@nestjs/common';
import { APP_FILTER } from '@nestjs/core';
import { AllExceptionsFilter } from './filters/all-exceptions.filter';
import { AppController } from './app.controller';
import { User } from './entities/user.entity';
import { Account } from './entities/account.entity';
import { Mail } from './entities/mail.entity';
import { AppService } from './app.service';
import { AuthModule } from './auth/auth.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { MailAccountModule } from './mail-account/mail-account.module';
import { MailerModule } from './mailer/mailer.module';
@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'mariadb',
      host: '10.2.0.195',
      port: 3306,
      username: 'mailer',
      password: 'mailer',
      database: 'mailer',
      entities: [User, Account, Mail],
      synchronize: true,
      logging: true,
    }),
    AuthModule,
    MailAccountModule,
    MailerModule,
  ],
  controllers: [AppController],
  providers: [
    AppService,
    {
      provide: APP_FILTER,
      useClass: AllExceptionsFilter,
    },
  ],
})
export class AppModule {}
